package org.zero.onlinesubject.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.zero.onlinesubject.common.vo.Result;

@RestControllerAdvice
@Slf4j
public class ExceptionHandlerController {

//    @ExceptionHandler(value = Exception.class)
//    public Result<String> exceptionHandler(Exception e){
//        log.error("全局异常捕获>>>: {}",e.getMessage());
//        return Result.error(500,"全局异常捕获,错误原因>>>"+e.getMessage());
//    }
//
//    @ExceptionHandler(value = RuntimeException.class)
//    public Result<String> rtExceptionHandler(RuntimeException e){
//        log.error("发生运行时异常: {}",e.getMessage());
//        return Result.error(500,e.getMessage());
//    }
}
